#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main() {
	char s1[101] = {0};
	char s2[101] = {0};
	fgets(s1, 101, stdin);
	fgets(s2, 101, stdin);
	int Len1 = strlen(s1);
	int Len2 = strlen(s2);
	if (s1[Len1 - 1] == '\n')
		s1[--Len1] = '\0';
	if (s2[Len2 - 1] == '\n')
		s2[--Len2] = '\0';
	int i, j;
	int count = 0;
	int Lcs = 0;
	for (i = 0; i < Len1; i++) {
		if (isupper(s1[i]))
			s1[i] = tolower(s1[i]);
	}
	for (i = 0; i < Len2; i++) {
		if (isupper(s2[i]))
			s2[i] = tolower(s2[i]);
	}

	for (i = 0; i < Len1; i++) {
		for (j = 0; j < Len2; j++) {

			count = 0;
			while ((i + count) < Len1 && (j + count) < Len2 && (s1[i + count] == s2[j + count])) {
				count++;
			}
			if (count > Lcs)
				Lcs = count;
		}
	}
	double x = (2.0 * Lcs) / (Len1 * 1.0 + Len2 * 1.0);
	printf("%.3f", x);
	return 0;
}